package logic

import (
	"context"
	"product/model/mysql"

	"product/productrpc/internal/svc"
	"product/productrpc/productrpc"

	"github.com/zeromicro/go-zero/core/logx"
)

type ProductDeleteLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewProductDeleteLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ProductDeleteLogic {
	return &ProductDeleteLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 商品删除
func (l *ProductDeleteLogic) ProductDelete(in *productrpc.ProductDeleteRequest) (*productrpc.ProductDeleteResponse, error) {
	// todo: add your logic here and delete this line
	mysql.DB.Debug().Delete(&mysql.Products{}, in.ProductId)
	return &productrpc.ProductDeleteResponse{}, nil
}
